package train48days;

import java.util.Scanner;

public class 发邮件 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long[] count =new long[21];
        count[1]=0;
        count[2]=1;
        for (int i = 3; i <21 ; i++) {
            count[i]=(i-1)*(count[i-1]+count[i-2]);
        }
        while (sc.hasNext()){
            int n =sc.nextInt();
            long res= count[n];
            System.out.println(res);
        }
    }
}
